using System;

using Outcoding.GraphGenerator.Entities;

namespace Outcoding.GraphGenerator.Generator {
    public class ChartLocator {

        public ChartLocator(Entities.SlideLayout layout, int index) {
            this.LoadValues(layout, index);
        }

        private int mTop;

        public int Top {
            get { return mTop; }
            set { mTop = value; }
        }

        private int mLeft;

        public int Left {
            get { return mLeft; }
            set { mLeft = value; }
        }

        private int mHeight;

        public int Height {
            get { return mHeight; }
            set { mHeight = value; }
        }

        private int mWidth;

        public int Width {
            get { return mWidth; }
            set { mWidth = value; }
        }

        private void LoadValues(Entities.SlideLayout layout, int index) {
            switch(layout){
                case SlideLayout.ppLayoutLargeObject:
                    LoadLargeObjectPosition(index);
                    break;
                case SlideLayout.ppLayoutText:
                    LoadTextPosition(index);
                    break;
                case SlideLayout.ppLayoutTwoColumnText:
                    LoadTwoColumnText(index);
                    break;
                case SlideLayout.ppLayoutObjectOverText:
                    LoadObjectOverText(index);
                    break;
                case SlideLayout.ppLayoutTextAndTwoObjects:
                    LoadTextAndTwoObjects(index);
                    break;
                case SlideLayout.ppLayoutTwoObjectsAndText:
                    LoadTwoObjectsAndText(index);
                    break;
                case SlideLayout.ppLayoutTwoObjectsOverText:
                    LoadTwoObjectsOverText(index);
                    break;
                case SlideLayout.ppLayoutFourObjects:
                    LoadFourObjects(index);
                    break;
            }
        }

        private void LoadLargeObjectPosition(int index) {
            if (index == 0) {
                mTop = 50;
                mLeft = 30;
                mHeight = 450;
                mWidth = 650;
            }
        }

        private void LoadTextPosition(int index){
            // index = 0 reserved for text
            if (index == 1) {
                mTop = 115;
                mLeft = 20;
                mHeight = 415;
                mWidth = 680;
            }
        }

        private void LoadTwoColumnText(int index) {
            // index = 0 reserved for text
            if (index == 1) {
                mTop = 115;
                mLeft = 20;
                mHeight = 415;
                mWidth = 320;
            }
            if (index == 2) {
                mTop = 115;
                mLeft = 360;
                mHeight = 415;
                mWidth = 320;
            }
        }

        private void LoadObjectOverText(int index) {
            // index = 0 reserved for text
            if (index == 1) {
                mTop = 115;
                mLeft = 20;
                mHeight = 195;
                mWidth = 680;
            }
            if (index == 2) {
                mTop = 335;
                mLeft = 20;
                mHeight = 195;
                mWidth = 680;
            }
        }

        private void LoadTextAndTwoObjects(int index) {
            // index = 0 reserved for text
            if (index == 1) {
                mTop = 115;
                mLeft = 20;
                mHeight = 415;
                mWidth = 320;
            }
            if (index == 2) {
                mTop = 115;
                mLeft = 360;
                mHeight = 195;
                mWidth = 320;
            }
            if (index == 3) {
                mTop = 335;
                mLeft = 360;
                mHeight = 195;
                mWidth = 320;
            }
        }

        private void LoadTwoObjectsAndText(int index) {
            // index = 0 reserved for text
            if (index == 1) {
                mTop = 115;
                mLeft = 20;
                mHeight = 195;
                mWidth = 320;
            }
            if (index == 2) {
                mTop = 335;
                mLeft = 20;
                mHeight = 195;
                mWidth = 320;
            }
            if (index == 3) {
                mTop = 115;
                mLeft = 360;
                mHeight = 415;
                mWidth = 320;
            }
        }

        private void LoadTwoObjectsOverText(int index) {
            // index = 0 reserved for text
            if (index == 1) {
                mTop = 115;
                mLeft = 20;
                mHeight = 195;
                mWidth = 320;
            }
            if (index == 2) {
                mTop = 115;
                mLeft = 360;
                mHeight = 195;
                mWidth = 320;
            }
            if (index == 3) {
                mTop = 335;
                mLeft = 20;
                mHeight = 195;
                mWidth = 680;
            }
        }

        private void LoadFourObjects(int index) {
            // index = 0 reserved for text
            if (index == 1) {
                mTop = 115;
                mLeft = 20;
                mHeight = 195;
                mWidth = 320;
            }
            if (index == 2) {
                mTop = 115;
                mLeft = 360;
                mHeight = 195;
                mWidth = 320;
            }
            if (index == 3) {
                mTop = 335;
                mLeft = 20;
                mHeight = 195;
                mWidth = 320;
            }
            if (index == 4) {
                mTop = 335;
                mLeft = 360;
                mHeight = 195;
                mWidth = 320;
            }
        }
    }
}
